scrolledwindow: Avoid too frequent redraws of scrollbars
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 17 Nov 2014 15:55:08 +0000 (16:55 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Mon, 17 Nov 2014 15:55:08 +0000 (16:55 +0100)
When overshooting through touchpad kinetic scrolling, the scrollbar remains
mostly static as it already hit a boundary. However, the fade in/out checks
are constantly run during scroll events, causing needless redraws in this
specific case.

gtk/gtkscrolledwindow.c

index 3d33d600b468f4fa1c2bb179923fa88501059e30..86a53d75fb7327489844dd9965a6a50935f246b0 100644 (file)
@@ -3387,7 +3387,9 @@ static void
 indicator_set_fade (Indicator *indicator,
                     gdouble    pos)
 {
-  gboolean visible;
+  gboolean visible, changed;
+
+  changed = indicator->current_pos != pos;
   indicator->current_pos = pos;
 
   visible = indicator->current_pos != 0.0 || indicator->target_pos != 0.0;
@@ -3404,8 +3406,11 @@ indicator_set_fade (Indicator *indicator,
       indicator->conceil_timer = 0;
     }
 
-  gtk_widget_set_opacity (indicator->scrollbar, indicator->current_pos);
-  gtk_widget_queue_draw (indicator->scrollbar);
+  if (changed)
+    {
+      gtk_widget_set_opacity (indicator->scrollbar, indicator->current_pos);
+      gtk_widget_queue_draw (indicator->scrollbar);
+    }
 }
 
 static double